package top.lyc829.zzl_android.logic.network;

import org.jetbrains.annotations.NotNull;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import top.lyc829.zzl_android.logic.util.Utils;

/**
 * 签名拦截器，添加token、ContentType
 * @Author lyc
 * @create 2021-03-12 19:21
 */
public class SignInterceptor implements Interceptor {
    @NotNull
    @Override
    public Response intercept(@NotNull Chain chain) throws IOException {

        Request request =  chain.request().newBuilder()
                .addHeader("token", Utils.getValueFromSp("token"))
                .addHeader("Content-Type", "application/json; charset=utf-8")
                .build();

        return chain.proceed(request);

    }
}
